<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<base href="<?php echo base_url(); ?>"/>
<title><?php echo $title; ?></title>
<link href="style/base.css" rel="stylesheet" type="text/css"/>
<link href="style/common.css" rel="stylesheet" type="text/css"/>
<link href="style/houtai.css" rel="stylesheet" type="text/css"/>
<link href="style/my.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script src="js/organictabs.jquery.js"></script>
<script type="text/javascript" src="js/Common.js"></script>
<script type="text/javascript" src="js/Validation.js"></script>
<script type="text/javascript" src="jscript/WdatePicker.js"></script>
<script type="text/javascript" src="js/jquery.form.js"></script>
<script type="text/javascript" src="js/jquery.blockUI.js"></script>
<script type="text/javascript" language="javascript" src="js/ie6/DD_belatedPNG_0.0.8a-min.js"></script>
<script type="text/javascript">
    $(function () {
        //选中filter下的所有a标签，为其添加hover方法，该方法有两个参数，分别是鼠标移上和移开所执行的函数。
        $("#filter a").hover(
            function () {
                $(this).addClass("seling");
            },
            function () {
                $(this).removeClass("seling");
            }
        );


        //选中filter下所有的dt标签，并且为dt标签后面的第一个dd标签下的a标签添加样式seled。(感叹jquery的强大)
        $("#filter dt+dd a").attr("class", "seled");
        /*注意：这儿应该是设置(attr)样式，而不是添加样式(addClass)，
         不然后面通过$("#filter a[class='seled']")访问不到class样式为seled的a标签。*/


    });
</script>
<!--[if IE 6]>
<script type="text/javascript" language="javascript">
    DD_belatedPNG.fix('.logo img,.footer_logo img');
</script>
<![endif]-->
<script type="text/javascript">
$(function () {
    initSelected();
    $("#txtHigh").bind("blur", function () {
        checkSize("txtHigh")
    });
    $("#txtWeight").bind("blur", function () {
        checkSize("txtWeight")
    });
    $("#txtShoeSize").bind("blur", function () {
        checkSize("txtShoeSize")
    });
    $("#txtChestSize").bind("blur", function () {
        checkSize("txtChestSize")
    });
    $("#txtWaistSize").bind("blur", function () {
        checkSize("txtWaistSize")
    });
    $("#txtButtSize").bind("blur", function () {
        checkSize("txtButtSize")
    });
    loadUserInfo();
    $("#btnNext").bind("click", save);
});
function saveArchiveHead(src) {
    var params = {headurl: src};
    $.ajax({
        type: "post",
        url: "index.php/login/saveArchiveHead",
        dataType: "json",
        data: params,
        success: function (data) {

        }
    });
}
function loadUserInfo() {
    $.ajax({
        type: "post",
        url: "index.php/login/getUserInfo",
        dataType: "json",
        success: function (data) {
            $("#txtHigh").val(data.high);
            $("#txtWeight").val(data.weight);
            $("#txtShoeSize").val(data.shoesize);
            $("#txtChestSize").val(data.chestsize);
            $("#txtWaistSize").val(data.waistsize);
            $("#txtButtSize").val(data.buttsize);
            setSelect("dlnature", data.worknature);
            setSelect("dltype", data.modeltype);
            setSelect("dlstyle", data.modelstyle);
            setSelect("dlhair", data.modelhair);
            setSelect("dlskin", data.modelskin);
            setSelect("dlbody", data.modelbody);
        }
    });
}
function setSelect(id, value) {
    if (IsEmpty(value))
        return;
    $("#" + id).find("a").each(function () {
        $(this).removeClass("seled");
        var av = "/" + $(this).attr("value") + "/";
        if (value.indexOf(av) != -1)
            $(this).trigger("click");
    });
}
function checkSize(id) {
    var v = $("#" + id).val();
    if (IsEmpty(v)) {
        SetError(id, "必填");
        return false;
    }
    if (!IsInt(v)) {
        SetError(id, "必须为整数");
        return false;
    }
    if (v <= 0 || v > 260) {
        SetError(id, "须界于1~260");
        return false;
    }
    SetOK(id);
    return true;
}
function checkSelect(id) {

    if ($("#" + id).find("a[class='seled']").length == 0) {
        SetError(id, "请至少选一项");
        return false;
    }
    ClearError(id);
    return true;
}
function getSelectId(id) {
    var v = "";
    $("#" + id).find("a[class='seled']").each(function () {

        v += $(this).attr("value") + "/";
    });
    return v;
}
function save() {
    if (checkSize("txtHigh") == false)
        return;
    if (checkSize("txtWeight") == false)
        return;
    if (checkSize("txtShoeSize") == false)
        return;
    if (checkSize("txtChestSize") == false)
        return;
    if (checkSize("txtWaistSize") == false)
        return;
    if (checkSize("txtButtSize") == false)
        return;
    if (checkSelect("dlnature") == false)
        return;
    if (checkSelect("dltype") == false)
        return;
    if (checkSelect("dlstyle") == false)
        return;
    if (checkSelect("dlhair") == false)
        return;
    if (checkSelect("dlskin") == false)
        return;
    if (checkSelect("dlbody") == false)
        return;


    var high = $("#txtHigh").val();
    var weight = $("#txtWeight").val();
    var shoesize = $("#txtShoeSize").val();
    var chestsize = $("#txtChestSize").val();
    var waistsize = $("#txtWaistSize").val();
    var buttsize = $("#txtButtSize").val();

    var worknature = getSelectId("dlnature");
    var modeltype = getSelectId("dltype");
    var modelstyle = getSelectId("dlstyle");
    var modelhair = getSelectId("dlhair");
    var modelskin = getSelectId("dlskin");
    var modelbody = getSelectId("dlbody");

    //alert(worknature+"-"+modeltype+"-"+modelstyle+"-"+modelhair+"-"+modelskin+"-"+modelbody);
    //return;


    var params = {
        high: high,
        weight: weight,
        shoesize: shoesize,
        chestsize: chestsize,
        waistsize: waistsize,
        buttsize: buttsize,
        worknature: worknature,
        modeltype: modeltype,
        modelstyle: modelstyle,
        modelhair: modelhair,
        modelskin: modelskin,
        modelbody: modelbody
    };
    var url = "index.php/login/saveArchiveTwo";
    $.ajax({
        type: "post",
        url: url,
        dataType: "json",
        data: params,
        success: function (data) {
            if (data.ReturnCode == 1) {
                if ($("#btnNext").attr("src") == "images/bc_inp.jpg") {
                    alert('保存成功');
                    window.location = "<?php echo base_url();?>index.php/manage/marchive";

                } else {
                    window.location = "<?php echo base_url();?>index.php/login/experience";
                }
            } else {
                alert('保存失败');
            }
        }
    });
}

//初始化性别选择样式
function initSelected() {
    //选中filter下的所有a标签，为其添加hover方法，该方法有两个参数，分别是鼠标移上和移开所执行的函数。
    $("dd a").hover(
        function () {
            $(this).addClass("seling");
        },
        function () {
            $(this).removeClass("seling");
        }
    );
    //选中filter下所有的dt标签，并且为dt标签后面的第一个dd标签下的a标签添加样式seled。(感叹jquery的强大)
    //$("dd a :first").attr("class", "seled"); /*注意：这儿应该是设置(attr)样式，而不是添加样式(addClass)，
    //                                   不然后面通过$("#filter1 a[class='seled']")访问不到class样式为seled的a标签。*/

    //为filter下的所有a标签添加单击事件
    $("#dlnature,#dlhair,#dlskin,#dlbody").find("a").click(function () {
        $(this).parents("dl").find("a").each(function () {
            //下面三种方式效果相同（第三种写法的内部就是调用了find()函数，所以，第二、三种方法是等价的。）
            //$(this).children("div").children("a").removeClass("seled");
            //$(this).find("a").removeClass("seled");
            $(this).removeClass("seled");
        });

        $(this).attr("class", "seled");
    });

    $("#dltype,#dlstyle").find("a").click(function () {
        $(this).toggleClass("seled");
    });

}
</script>
</head>

<body>
<!-- head S-->
<?php
include 'header.php';
?>
<!-- head E-->

<div class="houtai_content mt_10 clearfix">
<!-- 侧栏 开始 -->
<?php
include 'member_left.php';
?>
<!-- 侧栏 结束 -->

<!-- 用户中心模特档案 S -->
<div class="houtai_main">
<div class="houtai_mtda">
<div class="houtai_main_tit">用户中心—模特档案</div>
<div class="houtai_mtda_cnt">
<form id="formArchive" action="index.php/login/uploadImg" method="post" enctype="multipart/form-data">
<!-- 模特档案 开始 -->
<div class="dangan">
    <table class="tablearchive">
        <tr>
            <td><span>身高(CM)：</span><input id="txtHigh" name=""
                                           style="width: 100px; height: 24px;" type="text"/></td>
            <td><span>体重(KG)：<input id="txtWeight" name=""
                                    style="width: 100px; height: 24px;" type="text"/></td>
            <td></span> <span>鞋码(MA)：<input id="txtShoeSize" name=""
                                            style="width: 100px; height: 24px;" type="text"/></span></td>
        </tr>
        <tr>
            <td><span>胸围(CM)：<input id="txtChestSize" name=""
                                    style="width: 100px; height: 24px;" type="text"/></span></td>
            <td><span>腰围(CM)：<input id="txtWaistSize" name=""
                                    style="width: 100px; height: 24px;" type="text"/></span></td>
            <td><span>臀围(CM)：<input id="txtButtSize" name=""
                                    style="width: 100px; height: 24px;" type="text"/></span></td>
        </tr>
    </table>

</div>
<!-- 模特档案 结束 -->

<!-- 选择代码 开始 -->
<div id="filter">
    <dl id="dlnature">
        <dt>
            <span>模特身份：</span>
        </dt>
        <dd>
            <div>
                <a value="1" class="seled">兼职模特</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="2">全职模特</a>
            </div>
        </dd>
    </dl>
    <dl id="dltype">
        <dt>
            <span>模特类型（多选）：</span>
        </dt>
        <dd>
            <div>
                <a value="1">平面/广告</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="2">T台走秀</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="3">车展/礼仪</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="4" class="seled">局部/内衣</a>
            </div>
        </dd>
    </dl>
    <dl id="dlstyle">
        <dt>
            <span>我的风格（多选）：</span>
        </dt>
        <dd>
            <div>
                <a value="1">性感</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="2">甜美</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="3">熟女</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="4">运动</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="5">清新</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="6">狂野</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="7">职业OL</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="8">欧美</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="9">日韩</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="10">民族</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="11" class="seled">传统</a>
            </div>
        </dd>
    </dl>
    <dl id="dlhair">
        <dt>
            <span>发型长度：</span>
        </dt>
        <dd>
            <div>
                <a value="1" class="seled">长发</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="2">中短发</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="3">短发</a>
            </div>
        </dd>
    </dl>
    <dl id="dlskin">
        <dt>
            <span>肤色：</span>
        </dt>
        <dd>
            <div>
                <a value="1" class="seled">苗条</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="2">标准</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="3">略胖</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="4">丰满</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="5">健美</a>
            </div>
        </dd>
    </dl>
    <dl id="dlbody">
        <dt>
            <span>体形：</span>
        </dt>
        <dd>
            <div>
                <a value="1" class="seled">苗条</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="2">标准</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="3">略胖</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="4">丰满</a>
            </div>
        </dd>
        <dd>
            <div>
                <a value="5">健美</a>
            </div>
        </dd>
    </dl>

</div>
<div class="clear"></div>
<div class='filter_inp'><img id='btnNext' class='link' src='images/bc_inp.jpg'></div>
</form>
</div>
</div>
</div>
<!-- 用户中心模特档案 E -->
</div>
<!-- 底部 S -->
<?php include 'footer.php'; ?>
<!-- 底部 E -->
</body>
</html>
